package com.gg.hc.controller;

import com.gg.common.pojo.MDesignProcedureModule;
import com.gg.hc.search.PageVo;
import com.gg.hc.service.MDesignProcedureModuleService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

@Controller
public class MDesignProcedureModuleController {

    @Resource
    private MDesignProcedureModuleService mDesignProcedureModuleService;



    @ResponseBody
    @RequestMapping("/deleteDesignModuleByParentId.action")
    public int deleteDesignModuleByParentId(Integer parentId){
        return mDesignProcedureModuleService.deleteDesignModuleByParentId(parentId);
    }
    @ResponseBody
    @RequestMapping("/queryMDesignProcedureModuleAll.action")
    public PageVo<MDesignProcedureModule> queryMDesignProcedureModuleAll(@RequestBody PageVo pageVo){
        return mDesignProcedureModuleService.queryAll(pageVo);
    }
    @ResponseBody
    @RequestMapping("/AddMDesignProcedureModule.action")
    public int AddMDesignProcedureModule(@RequestBody MDesignProcedureModule mDesignProcedureModule){
        return mDesignProcedureModuleService.AddMDesignProcedureModule(mDesignProcedureModule);
    }
    @ResponseBody
    @RequestMapping("/queryMDesignProcedureModuleByParentId.action")
    public List<MDesignProcedureModule> queryMDesignProcedureModuleByParentId(Integer id){
        return mDesignProcedureModuleService.queryMDesignProcedureModuleByParentId(id);
    }
    @ResponseBody
    @RequestMapping("/updateMDesignProcedureModule.action")
    public int updateMDesignProcedureModule(@RequestBody List<MDesignProcedureModule> mDesignProcedureModules){
        return mDesignProcedureModuleService.updateDModuleDetails(mDesignProcedureModules);
    }
    @ResponseBody
    @RequestMapping("/insertDModuleDetails.action")
    public int insertDModuleDetails(@RequestBody List<MDesignProcedureModule> mDesignProcedureModules){
//        System.out.println("进来了");
//        System.out.println(mDesignProcedureModules);
//        return 0;
        return mDesignProcedureModuleService.insertDModuleDetails(mDesignProcedureModules);
    }
    @ResponseBody
    @RequestMapping("/deleteMDesignProcedureModule.action")
    public int deleteMDesignProcedureModule(@RequestBody List<MDesignProcedureModule> mDesignProcedureModules){
        return mDesignProcedureModuleService.deleteMDesignProcedureModule(mDesignProcedureModules);
    }@ResponseBody
    @RequestMapping("/queryMDesignProcedureModuleByProductId.action")
    public int deleteMDesignProcedureModule(int productId){
        return mDesignProcedureModuleService.queryMDesignProcedureModuleByProductId(productId);
    }
}
